/*************
author:: libo
license:: MIT
*****************/

#ifndef LIB_CELL_ITERATOR_H
#define LIB_CELL_ITERATOR_H

#include "Mesh_Frame.h"
#include "libcell_iteratorc.h"
#include<iterator/cstruct_iterator.h>

#include<tools/intrbtree.h>
#include<tools/intrbtree_iterator.h>
#define iterator_v lib_cell_iterator_vertices
#define iterator_f lib_cell_iterator_faces
#define iterator_c lib_cell_iterator_cells
#define iterator_edge lib_cell_iterator_edge

#define quote lib_cell_quote


iterator_v operator++(iterator_v&); 
iterator_v operator++(iterator_v&,int);
static inline template_v* quote( iterator_v vv_)
{

    return vv_.value==NULL?((template_v*)(*(vv_.it))):vv_.value[vv_.i];
}
template_v operator*(iterator_v& );
bool operator!=(const iterator_v&,const iterator_v&);


iterator_f operator++(iterator_f&);
iterator_f operator++(iterator_f&,int);

static inline template_f* quote(iterator_f f_)
{

    return  f_.node.value==NULL?((template_f*)(*(f_.it))):((template_f*)(*(f_.node)));

}
template_f operator*(iterator_f&);
bool operator!=(const iterator_f&,const iterator_f&);


void iterator_c_init(iterator_c*);
iterator_c operator++(iterator_c&);
iterator_c operator++(iterator_c&,int);
template_c operator*(iterator_c&);
static inline template_c* quote(iterator_c c_)
{
    return c_.node.value==NULL?((template_c*)(*(c_.it))):((template_c*)(*(c_.node)));

}
bool operator!=(const iterator_c&,const iterator_c&);


iterator_hf operator++(iterator_hf&);
iterator_hf operator++(iterator_hf&,int);

static inline template_hf* quote(iterator_hf it)
{
    return it.node.value==NULL?((template_hf*)(*(it.it))):((template_hf*)(*(it.node)));
}

template_hf operator*(iterator_hf&);
bool operator!=(const iterator_hf&,const iterator_hf&);

iterator_edge operator++(iterator_edge&);
iterator_edge operator++(iterator_edge&,int);
bool operator!=(const iterator_edge&,const iterator_edge &);

//auto Mesh_vertices_begin(struct Mesh*);
//auto Mesh_veritces_end(struct Mesh*);
#undef iterator_v 
#undef iterator_f 
#undef iterator_c 
#undef iterator_edge 

#undef quote
#endif
